import http from "@/utils/http"
/**
 * @description 获取订单详情
 * @returns Promise
 */
export const reqOrderInfo = () => {
  return http.get("/order/trade")
}

/**
 * @description 获取订单详情页面的收获地址
 * @returns Promise
 */
export const reqOrderAddress = () => {
  return http.get("/userAddress/getOrderAddress")
}

/**
 * @description 获取立即购买商品的详细信息
 * @param {Object}  param   {goodsId:商品id,blessing:祝福语}
 * @returns Promise
 */
export const reqBuyNowGoods = ({
  goodsId,
  ...data
}) => {
  return http.get(`/order/buy/${goodsId}`, data)
}

/**
 * @description 用来提交订单
 * @returns Promise
 */
export const reqSubmitOrder = (data) => {
  return http.post("/order/submitOrder", data)
}


/**
 * @description 获取微信支付预支付信息
 * @param {*} orderNo 订单id
 */
export const reqPrePayInfo = (orderNo) => {
  return http.get(`/webChat/createJsapi/${orderNo}`)
}

/**
 * @description 获取微信支付状态
 * @param {*} orderNo 订单id
 * @returns Promise
 */
export const reqPayStatus = (orderNo) => {
  return http.get(`/webChat/queryPayStatus/${orderNo}`)
}

/**
 * @description 获取订单标号
 * @returns Promise
 */
export const reqOrderList = (page, limit) => {
  return http.get(`/order/order/${page}/${limit}`)
}